// 登录鉴权
const checkLogin = () => {
	// 获取token 
	const token = uni.getStorageSync('token');
	if (!token) {
		// 跳转到登录页
		// 携带当前页路由
		const pages = getCurrentPages();
		const currentPageRoute = "/"+pages[pages.length-1].route;
		// 跳转到登录页携带当前页路径
		uni.redirectTo({
			url: "/pages/login/login?redirect="+currentPageRoute
		})
		uni.showToast({
			title:"请登录访问"
		})
	}
}
const getToken = () => uni.getStorageSync('token');
const removeUserInfo = () => {
	uni.removeStorageSync('token');
	uni.removeStorageSync('uid');
	uni.removeStorageSync('openid');
}
export {
	checkLogin,
	getToken,
	removeUserInfo
}